package com.js.blog.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.js.blog.bean.Article;
import com.js.blog.dao.ArticleMapper;
import com.js.blog.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author yanglin
 * @create 2024-03-01 11:40 星期五
 * description:
 */
@Service
public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> implements ArticleService {

    @Autowired
    ArticleMapper articleMapper;

    /**
     * 获取文章分页列表
     */
    @Override
    public IPage<Article> selectPage(Page<Article> articlePage, Long id) {
        LambdaQueryWrapper<Article> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(Article::getUserId,id);
        Page<Article> pageModel = articleMapper.selectPage(articlePage, wrapper);
        return pageModel;
    }
}
